package com.resjz.milddog.Implement.user;


import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.resjz.milddog.Interface.user.UserInterface;
import com.resjz.milddog.entity.user.UserEntity;
import com.resjz.milddog.vo.user.UserVo;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Method;
import org.springframework.beans.factory.annotation.Autowired;
import com.resjz.milddog.service.user.userService;

import java.util.List;
import java.util.Map;

@org.apache.dubbo.config.annotation.DubboService(version = "${dubbo.service.version}",retries = 2)
@Slf4j
public class UserInterfaceImpl implements UserInterface {
    @Autowired
    private userService userService;
    @Override
    public UserVo getUserByUserId(Long userId) {
        System.out.println("31313131");
        UserEntity userEntity = userService.getuserByUserId(userId);
        if(userEntity==null){
            return null;
        }
        UserVo userVo = new UserVo();
        BeanUtil.copyProperties(userEntity,userVo);
        return userVo;
    }

    @Override
    public List<Map<String, Object>> getUserMenus(Long userId) {
        return null;
    }

    @Override
    public Integer userInDeptCnt(Long deptId) {
        return userService.count(new QueryWrapper<UserEntity>().eq("dept_id",deptId));
    }
}
